import { createRouter, createWebHashHistory } from 'vue-router'

import Home from '@/views/Home.vue';
import UserManage from '@/views/UserManage.vue';
import RoleManage from '@/views/RoleManage.vue';
import PermissionManage from '@/views/PermissionManage.vue';

const routes = [
    {
        path: '/',
        redirect: '/home'
    },
    {
        path: '/home',
        name: 'Home',
        component: Home,
        redirect: '/userManage',
        children: [
            {
                path: '/userManage',
                name: 'UserManage',
                component: UserManage,
            },
            {
                path: '/roleManage',
                name: 'RoleManage',
                component: RoleManage,
            },
            {
                path: '/permissionManage',
                name: 'PermissionManage',
                component: PermissionManage,
            },
        ]
    },
    {
        path: '/:pathMatch(.*)',
        name: 'Error',
        component: Error,
    },
]

const router = createRouter({
    history: createWebHashHistory(),
    routes
})

export default router